<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="header.jsp" %>

<div class="card shadow">
    <div class="card-header bg-info text-white">
        <h4 class="mb-0"><i class="fas fa-bullhorn me-2"></i>社区公告</h4>
    </div>
    <div class="card-body">
        <c:forEach items="${notices}" var="notice">
            <div class="card mb-3">
                <div class="card-body">
                    <h5 class="card-title text-primary">
                        <i class="fas fa-newspaper me-2"></i>${notice.title}
                    </h5>
                    <div class="text-muted small mb-2">
                        <i class="fas fa-calendar-alt me-1"></i>
                        发布时间：${notice.publishTime}
                    </div>
                    <p class="card-text">${notice.content}</p>
                </div>
            </div>
        </c:forEach>

        <!-- 分页 -->
        <nav aria-label="公告分页">
            <ul class="pagination justify-content-center">
                <li class="page-item ${page.currentPage == 1 ? 'disabled' : ''}">
                    <a class="page-link" href="?page=${page.currentPage - 1}">上一页</a>
                </li>
                <c:forEach begin="1" end="${page.totalPages}" var="p">
                    <li class="page-item ${p == page.currentPage ? 'active' : ''}">
                        <a class="page-link" href="?page=${p}">${p}</a>
                    </li>
                </c:forEach>
                <li class="page-item ${page.currentPage == page.totalPages ? 'disabled' : ''}">
                    <a class="page-link" href="?page=${page.currentPage + 1}">下一页</a>
                </li>
            </ul>
        </nav>
    </div>
</div>
<%@ include file="footer.jsp" %>